//2009/08/11 20:18:47
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class Reppity
{
public:
    int longestRep(string input)
    {
        int score = 0;
        for (int i=1; i<=input.size(); i++)
        {
            for (int j=0; j+i<=input.size(); j++)
            {
                for (int k=j+i; k+i<=input.size(); k++)
                    if (input.substr(j,i) == input.substr(k,i))
                        score = max(score, i);
            }
        }
        return score;
    }
};
